<template>
    <div>
       <ul ref="box" class="box" @mousedown="down" >
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
    </div>
</template>

<script>
export default {
    name: '',
    data(){
        return{
            x:1,
            y:1
        }
    },
    methods:{
         down(e){
             var event = window.event || e;
            var disY = event.clientX - this.y;
            var disX = event.clientY - this.x;
           document.onmousemove =(e)=> {
            var event = window.event || e;
            this.x = event.clientY - disX;
            this.y = event.clientX - disY;
            this.$refs.box.style.transform = `rotateY(${this.y}deg) rotateX(${this.x}deg)`;
        }
        document.onmouseup = function(e) {
            document.onmousemove = null;
            document.onmouseup = null;
        }
        return false;
         },
         
    },
}
</script>

<style scoped>
 li {
            list-style: none;
        }
        
        body {
            perspective: 600px;
            /* perspective-origin: 50% 50%; */
        }
        
        .box {
            width: 200px;
            height: 200px;
            /* position: absolute;
            margin-left: 36%;
            margin-top: 6%; */
            /* border: 1px solid black; */
            transform-style: preserve-3d;
            /* transition: all 3s; */
            cursor: move;
            /* transform: rotateX(13deg); */
            /* animation: move 5s linear infinite; */
        }
        
        .box li {
            width: 200px;
            height: 200px;
            opacity: 0.8;
            position: absolute;
        }
        
        .box li:nth-child(1) {
            transform: rotateX(90deg) translateZ(100px);
            background: url("../assets/1.jpeg");
            background-size: 100% 100%;
        }
        
        .box li:nth-child(2) {
            transform: rotateX(90deg) translateZ(-100px);
            background: url("../assets/2.jpeg");
            background-size: 100% 100%;
        }
        
        .box li:nth-child(3) {
            transform: rotateY(90deg) translateZ(-100px);
            background: url("../assets/3.jpeg");
            background-size: 100% 100%;
        }
        
        .box li:nth-child(4) {
            transform: rotateY(90deg) translateZ(100px);
            background: url("../assets/4.jpg");
            background-size: 100% 100%;
        }
        
        .box li:nth-child(5) {
            transform: translateZ(-100px);
            background: url("../assets/5.jpeg");
            background-size: 100% 100%;
        }
        
        .box li:nth-child(6) {
            transform: translateZ(100px);
            background: url("../assets/6.jpeg");
            background-size: 100% 100%;
        }
        
        @keyframes move {
            0% {
                transform: rotateY(0deg);
            }
            100% {
                transform: rotateY(360deg);
            }
        }
</style>